import request from '@/sheep/request';

const ConsigneeApi = {
  // 获得用户收货人列表
  getAddressList: () => {
    return request({
      url: '/member/pickup/list',
      method: 'GET'
    });
  },
  // 创建用户收货人
  createAddress: (data) => {
    return request({
      url: '/member/pickup/create',
      method: 'POST',
      data,
      custom: {
        showSuccess: true,
        successMsg: '保存成功'
      },
    });
  },
  // 更新用户收货人
  updateAddress: (data) => {
    return request({
      url: '/member/pickup/update',
      method: 'PUT',
      data,
      custom: {
        showSuccess: true,
        successMsg: '更新成功'
      },
    });
  },
  // 获得用户收货人
  getAddress: (id) => {
    return request({
      url: '/member/pickup/get',
      method: 'GET',
      params: { id }
    });
  },
  // 删除用户收货人
  deleteAddress: (id) => {
    return request({
      url: '/member/pickup/delete',
      method: 'DELETE',
      params: { id }
    });
  },
};

export default ConsigneeApi;
